package nave.android.game;

import java.awt.Rectangle;
import java.awt.geom.Point2D;

import nave.android.framework.Graphics;


public  class Chave extends GameObject 
{
	boolean visivel = true;
	Rectangle chaveRectangle;
	
	public  Chave (Asset imagem, Point2D posicao, Point2D tamanho)
	{
		super (imagem,posicao,tamanho);
		chaveRectangle = new Rectangle ((int)posicao.getX(), (int)posicao.getY(), (int)tamanho.getX(), (int)tamanho.getY());
	}
	
	public void Update(Rectangle playerRect) 
	{
		if(visivel)
		{
			
			
			if(chaveRectangle.intersects(playerRect))
			{
				visivel = false;
			}
		}		
		
	}
	
	
	
	public void Draw(Graphics g) 
	{
		if(visivel)
		{
			g.drawPixmap(imagem, (int)posicao.getX(), (int)posicao.getY());
		}
		
	}
	
}
